unit EditFieldCap;

interface

uses
  Winapi.Windows, Winapi.Messages, SysUtils, Variants, Classes, Graphics,
  Controls, Forms, Dialogs, uniGUITypes, uniGUIAbstractClasses,
  uniGUIClasses, uniGUIForm, DB, DBClient, ClientRowSet, uniGUIBaseClasses,
  uniBasicGrid, uniDBGrid, uniButton, uniBitBtn, Clipbrd;

type
  TFrmEditFieldCap = class(TUniForm)
    UniDBGrid1: TUniDBGrid;
    dsFieldMap: TDataSource;
    UniBitBtn1: TUniBitBtn;
    procedure UniBitBtn1Click(Sender: TObject);
    procedure UniDBGrid1ColumnSort(Column: TUniDBGridColumn;
      Direction: Boolean);
    procedure UniFormShow(Sender: TObject);
    procedure UniDBGrid1CellClick(Column: TUniDBGridColumn);
    procedure UniDBGrid1DblClick(Sender: TObject);
  private
    { Private declarations }
    currField: TField;
  public
    { Public declarations }
    Grid:TuniDbGrid;
  end;

function FrmEditFieldCap: TFrmEditFieldCap;

implementation

{$R *.dfm}

uses
   MainModule, uniGUIApplication,ExpModule,uCommFunction;

function FrmEditFieldCap: TFrmEditFieldCap;
begin
  Result := TFrmEditFieldCap(UniMainModule.GetFormInstance(TFrmEditFieldCap));
end;


procedure TFrmEditFieldCap.UniBitBtn1Click(Sender: TObject);
begin
  TClientRowset(dsFieldMap.DataSet).ApplyUpdates;
  self.Close;
end;

procedure TFrmEditFieldCap.UniDBGrid1CellClick(Column: TUniDBGridColumn);
begin
  currField := Column.Field;
end;

procedure TFrmEditFieldCap.UniDBGrid1ColumnSort(Column: TUniDBGridColumn;
  Direction: Boolean);
begin
  SortColumn((UniDBGrid1.DataSource.DataSet as TClientRowSet), Column.FieldName, Direction);
end;

procedure TFrmEditFieldCap.UniDBGrid1DblClick(Sender: TObject);
begin
  if currField <> nil then
    Clipboard.AsText := currField.AsString;
end;

procedure TFrmEditFieldCap.UniFormShow(Sender: TObject);
begin
  SetCompoentLanguage(Self);
  SetFieldsSort(UniDBGrid1);
  currField := nil;
end;

end.
